#ifndef __MALLOC_H
#define __MALLOC_H

#include "common.h"



#ifndef NULL
#define NULL 0
#endif


#define INSRAM	0	  //Internal SRAM
#define EXSRAM  1	  //External SRAM 


#define INMEM_BLOCK_SIZE			32  	   //Memory block size 32byte
#define INMEM_MAX_SIZE			80*1024  	   //Total memory size 80K
#define INMEM_ALLOC_TABLE_SIZE	 INMEM_MAX_SIZE/INMEM_BLOCK_SIZE 	//Memory table size


#define EXMEM_BLOCK_SIZE			32  	   //32byte
#define EXMEM_MAX_SIZE			800*1024      //800K
#define EXMEM_ALLOC_TABLE_SIZE	 EXMEM_MAX_SIZE/EXMEM_BLOCK_SIZE 	
		 

void Memory_Init(u8 memx);   //Memory management initialization  (memx: 0:Internal SRAM  1:External SRAM)
u8 Mem_perused(u8 memx);	//Get memory usage


void *Mem_malloc(u8 memx,u32 size);			 

void *Remem_malloc(u8 memx,void *old,u32 size); 

void Mem_free(u8 memx,void *use);  	

#endif













